package services.impl;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import services.*;
	
public class ServiceManager {
	
	private static Map<String, List> AllServiceInstance = new HashMap<String, List>();
	
	private static List<LabManageSystem> LabManageSystemInstances = new LinkedList<LabManageSystem>();
	private static List<ThirdPartyServices> ThirdPartyServicesInstances = new LinkedList<ThirdPartyServices>();
	private static List<CreateTeamService> CreateTeamServiceInstances = new LinkedList<CreateTeamService>();
	private static List<JoinTeamService> JoinTeamServiceInstances = new LinkedList<JoinTeamService>();
	private static List<CreatePlanService> CreatePlanServiceInstances = new LinkedList<CreatePlanService>();
	private static List<CreateDailyService> CreateDailyServiceInstances = new LinkedList<CreateDailyService>();
	private static List<CheckPlanService> CheckPlanServiceInstances = new LinkedList<CheckPlanService>();
	private static List<ManageDailyService> ManageDailyServiceInstances = new LinkedList<ManageDailyService>();
	private static List<ManageAccountService> ManageAccountServiceInstances = new LinkedList<ManageAccountService>();
	
	static {
		AllServiceInstance.put("LabManageSystem", LabManageSystemInstances);
		AllServiceInstance.put("ThirdPartyServices", ThirdPartyServicesInstances);
		AllServiceInstance.put("CreateTeamService", CreateTeamServiceInstances);
		AllServiceInstance.put("JoinTeamService", JoinTeamServiceInstances);
		AllServiceInstance.put("CreatePlanService", CreatePlanServiceInstances);
		AllServiceInstance.put("CreateDailyService", CreateDailyServiceInstances);
		AllServiceInstance.put("CheckPlanService", CheckPlanServiceInstances);
		AllServiceInstance.put("ManageDailyService", ManageDailyServiceInstances);
		AllServiceInstance.put("ManageAccountService", ManageAccountServiceInstances);
	} 
	
	public static List getAllInstancesOf(String ClassName) {
			 return AllServiceInstance.get(ClassName);
	}	
	
	public static LabManageSystem createLabManageSystem() {
		LabManageSystem s = new LabManageSystemImpl();
		LabManageSystemInstances.add(s);
		return s;
	}
	public static ThirdPartyServices createThirdPartyServices() {
		ThirdPartyServices s = new ThirdPartyServicesImpl();
		ThirdPartyServicesInstances.add(s);
		return s;
	}
	public static CreateTeamService createCreateTeamService() {
		CreateTeamService s = new CreateTeamServiceImpl();
		CreateTeamServiceInstances.add(s);
		return s;
	}
	public static JoinTeamService createJoinTeamService() {
		JoinTeamService s = new JoinTeamServiceImpl();
		JoinTeamServiceInstances.add(s);
		return s;
	}
	public static CreatePlanService createCreatePlanService() {
		CreatePlanService s = new CreatePlanServiceImpl();
		CreatePlanServiceInstances.add(s);
		return s;
	}
	public static CreateDailyService createCreateDailyService() {
		CreateDailyService s = new CreateDailyServiceImpl();
		CreateDailyServiceInstances.add(s);
		return s;
	}
	public static CheckPlanService createCheckPlanService() {
		CheckPlanService s = new CheckPlanServiceImpl();
		CheckPlanServiceInstances.add(s);
		return s;
	}
	public static ManageDailyService createManageDailyService() {
		ManageDailyService s = new ManageDailyServiceImpl();
		ManageDailyServiceInstances.add(s);
		return s;
	}
	public static ManageAccountService createManageAccountService() {
		ManageAccountService s = new ManageAccountServiceImpl();
		ManageAccountServiceInstances.add(s);
		return s;
	}
}	
